import axios from 'axios'

const request8090 = axios.create({
    baseURL: 'http://localhost:8090',
    timeout: 5000,
    withCredentials: true // 允许携带凭证
})

//请求拦截器
request8090.interceptors.request.use((config) => {
//如果存在token，请求携带token
    if(window.sessionStorage.getItem('token')){
        console.log('token'+window.sessionStorage.getItem('token'))
        config.headers['token'] = window.sessionStorage.getItem('token');
    }
    return config ;
}, (error) => {
    Message.error({ message: error });
})

export default request8090